package common.page;

import java.util.Vector;

public class PageBean {
	public int getCurPage() {
		return curPage;
	}

	public void setCurPage(int curPage) {
		this.curPage = curPage;
	}

	public int getMaxPage() {
		return maxPage;
	}

	public void setMaxPage(int maxPage) {
		this.maxPage = maxPage;
	}

	public int getMaxRowCount() {
		return maxRowCount;
	}

	public void setMaxRowCount(int maxRowCount) {
		this.maxRowCount = maxRowCount;
	}

	public int getRowsPerPage() {
		return rowsPerPage;
	}

	public void setRowsPerPage(int rowsPerPage) {
		this.rowsPerPage = rowsPerPage;
	}

	public java.util.Vector getData() {
		return data;
	}

	public void setData(java.util.Vector data) {
		this.data = data;
	}

	public int curPage; // 当前是第几页
	public int maxPage; // 一共多少页
	public int maxRowCount; // 一共是多少行
	public int rowsPerPage = 5; // 每页多少行
	public java.util.Vector data; // 本页中的资料

	public PageBean() {

	}

	public void countMaxPage() // 根据总行数计算总页数
	{
		if (this.maxRowCount % this.rowsPerPage == 0) {
			this.maxPage = this.maxRowCount / this.rowsPerPage;
		} else {
			this.maxPage = this.maxRowCount / this.rowsPerPage + 1;
		}
	}

	public Vector getResult() {
		return this.data;
	}

//	public PageBean(ContactBean contact) throws SQLException {
//		this.maxRowCount = contact.getAvailableCount(); // 得到总行数
//		this.data = contact.getResult(); // 得到要显示于本页的资料
//		this.countMaxPage();
//	}
}